<?php 
$user=$session->read('User');
$username=$user["name"];
$company_name=$form->value('CompReport.company_name');
$contact=$form->value('CompReport.contact');
$cap_type=$form->value('CompReport.cap_type');
$capital=$form->value('CompReport.capital');
if($cap_type=="1"){
	$capital=$capital*$rate;
}
$reg_time=$form->value('CompReport.reg_time');
$resident_time=$form->value('CompReport.resident_time');
$tel=$form->value('CompReport.tel');

$comptype=count($objcompany["CompType"]);
$procvalue=count($objcompany["ProCvalue"]);
$is_height=$form->value('CompReport.is_height')=="1"?"1":"2";
$objAchievement=$objcompany["Achievement"];
$achievement=count($objAchievement);
$compachievement_output="";
$compachievement_award="";
if($objcompany["CompAchievement"]){
	$compachievement_output=$objcompany["CompAchievement"][0]["output_achievement"];
	$compachievement_award=$objcompany["CompAchievement"][0]["award_achievement"];
}
$objCompInstitution=$objcompany["CompInstitution"];
$CompInstitution=count($objCompInstitution);
$achievementschool=0;
foreach($objAchievement as $achievementstr){
	if($achievementstr["is_rely"]=="1"){
		$achievementschool++;
	}
}

$objcompeconomic=$objcompany["CompEconomic"];
$general_income=0;
$prospect=0;
$net_profit=0;
$over_taxes=0;
$qcll=0;
foreach($objcompeconomic as $economic){
	$general_income+=$economic["general_income"];
	$prospect+=$economic["prospect"];
	$net_profit+=$economic["net_profit"];
	$over_taxes+=$economic["over_taxes"];
	$qcll+=$economic["qcll"];
}

$objcompanypatent=$objcompany["CompanyPatent"];
$apply=0;
$applyinvent=0;
$authorize=0;
$authorizeinvent=0;
$buy=0;
foreach($objcompanypatent as $patent){
	$state=$patent['state'];
	$type_id=$patent['type_id'];
	if($state=="0"){
		$apply++;
		if($type_id==$invent){
			$applyinvent++;
		}
	}
	if($state=="2"){
		$authorize++;
		if($type_id==$invent){
			$authorizeinvent++;
		}
	}
	if($state=="3"){
		$buy++;
	}
}

$objcompperson=$objcompany["CompPerson"];
$compperson=count($objcompperson);
$dr=0;
$master=0;
$graduate=0;
$undergraduate=0;
$college=0;
$secondary=0;
$is_technical=0;
$is_rd=0;
$is_stuoversea=0;
$is_intern=0;
$intern_days=0;
$is_newgraduates=0;
foreach($objcompperson as $person){
	$education=$person['education'];
	if($education=="2" || $education=="3"){
		$graduate++;
	}
	if($education=="2"){
		$dr++;
	}else if($education=="3"){
		$master++;
	}else if($education=="4"){
		$undergraduate++;
	}else if($education=="5"){
		$college++;
	}else if($education=="6"){
		$secondary++;
	}
	if($person['is_technical']){
		$is_technical++;
	}else if($person['is_rd']){
		$is_rd++;
	}else if($person['is_stuoversea']){
		$is_stuoversea++;
	}else if($person['is_intern']){
		$is_intern++;
		$intern_days+=$person['intern_days'];
	}else if($person['is_newgraduates']){
		$is_newgraduates++;
	}
}

$objcompdepcost=$objcompany["DevelopmentCost"];
$cost=0;
$research_exp=0;
$new_product=0;
$govern_funding=0;
$raised_enterprise=0;
foreach($objcompdepcost as $depcost){
	$cost+=$depcost["cost"];
	$research_exp+=$depcost["research_exp"];
	$new_product+=$depcost["new_product"];
	$govern_funding+=$depcost["govern_funding"];
	$raised_enterprise+=$depcost["raised_enterprise"];
}

$objcomptechnology=$objcompany["CompTechnology"];
$comptechnology=count($objcomptechnology);
$national=0;
foreach($objcomptechnology as $technology){
   	 $department=$technology['department'];       
     if(in_array($department,$departidlist)){
		  $national++;
	}
}	
?>
<?php if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $company_name;?></h2>
	</div>
    <div class="right back_btn">
    <?php 
    $HTTP_REFERER=$_SERVER["HTTP_REFERER"];
    echo $html->link("返回",$HTTP_REFERER);?>
    </div>
   
    <?php
    	echo '<div class="right back_btn">';
    	$pindex="";
    	if($year!=""){
    		$pindex="?year=".$year;
    	}
		echo $html->link("导出报表","/reports/showcompinfo/".$id."/1".$pindex);
		echo '</div>';
	?> 
	<div class="form_sx_drop right">
    <?php 
		$objyear=$str->getafteryear();
    	echo $form->select('ddlyear',$objyear, $year, null,null);
	?>
	</div>
    <div class="clear"></div>
</div>
<?php }?>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<div class="details_info_content">
<style>
@page compinfo
	{
	margin:100px;
}
div.compinfo
	{page:compinfo;}
.compinfo{
	width:670px;font-size:9.0pt;padding-bottom:10px;font-family:"宋体";
}
.tinfo{
	margin-bottom:6px;
	padding-top:20px;
}
.tl{
	padding-left:20px;
	font-size:9.0pt;
	font-family:"宋体";height:23.0pt;line-height:23.0pt;
}
.line{
	border-bottom:1px solid #000000;height:17pt;
}

.info{
	width:100%;font-size:12px;
	border-collapse:collapse;
}
.info td,th{
	height:21pt;
}
.info .lit{
	font-weight:bold;
}
.dt{
	height:25px;
	line-height:25px;
}
.dleft{
	float:left;
}
.dright{
	float:right;
}
.xv{
	line-height:10.0pt;font-size:9.0pt;font-family:"宋体";
}
.qz{
	padding-left:17px;
}
.qzt{
	padding-left:52px;
}
</style>
<div class="compinfo">
  <!--[if gte vml 1]>
<v:rect
id="_x0000_s1027" style='position:absolute;left:0;text-align:left;
margin-left:324pt;margin-top:7.8pt;width:200px;height:66.6pt;text-indent:0;
z-index:1' filled="f" stroked="f">
<v:textbox style='mso-next-textbox:#_x0000_s1027' inset="0,0,0,0"/>
</v:rect><![endif]-->
  <div v:shape="_x0000_s1027"  style="z-index:1;position:absolute;left:460px;width:200px;">
	  <div class="xv">表    号：GZ－006F1</div>
	  <div class="xv">制表机关：科学技术部</div>
	  <div class="xv">批准机关：国家统计局</div>
	  <div class="xv">批准文号：国统制[2010]129号</div>
	  <div class="xv">有效期截止时间：2012年10月</div>
  </div>
  <div class="tinfo">
    <br/><br/><br/>
    <h3 style="text-align:center;font-weight:normal">领军人才企业情况</h3>
    <div class="tl">
 		企业名称（TDF8114）：<u><?php echo $str->sub_strlen($company_name,50);?></u>
     	企业法人代码（TDF8117）：<u><?php echo $str->sub_strlen($contact,10); ?></u>
    </div>
    <div class="tl">
		   注册时间（TDF8118）：<u><?php echo $str->sub_strlen($reg_time,10);?></u>
		  入驻领军人才时间（TDF8119）：<u><?php echo $str->sub_strlen($resident_time,10);?></u>
		  注册资金（TDF8121）：<u><?php echo $str->sub_strlen($capital,10);?></u>
    </div>
    <div class="tl">
		    填表人（TDF8114）：<u><?php echo $str->sub_strlen($username,10);?></u>
		    联系电话（TDF8115）：<u><?php echo $str->sub_strlen($tel,16);?></u>
		    传真（TDF8116）：<u><?php echo $str->sub_strlen($tel,16);?></u>
    </div>
  </div>
  <table class="info" border="1" bordercolor="#000000" cellspacing="0" cellpadding="0">
    <tr>
      <th style="width:195px">指标</th>
      <th style="width:68px"><div align="center">代码</div></th>
      <th style="width:68px"><div align="center">数值</div></th>
      <th style="width:195px"><div align="left">指标</div></th>
      <th style="width:68px"><div align="center">代码</div></th>
      <th style="width:68px"><div align="center">数值</div></th>
    </tr>
    <tr>
      <td colspan="3" class="lit">一、企业基本概况（单位：个）</td>
      <td colspan="3" class="lit">三、企业从业人员情况（单位：人）</td>
    </tr>
    <tr>
      <td>企业登记注册类型</td>
      <td><div align="center">TDF8J100</div></td>
      <td><div align="center"><?php echo $str->formatquantity($comptype); ?></div></td>
      <td>企业从业人员数</td>
      <td><div align="center">TDF8H300</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compperson); ?></div></td>
    </tr>
    <tr>
      <td>行业类别</td>
      <td><div align="center">TDF8J101</div></td>
      <td><div align="center"><?php echo $str->formatquantity($procvalue); ?></div></td>
      <td class="qz">其中：博士</td>
      <td><div align="center">TDF8H311</div></td>
      <td><div align="center"><?php echo $str->formatquantity($dr); ?></div></td>
    </tr>
    <tr>
      <td>经认定高新技术企业</td>
      <td><div align="center">TDF8J102</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_height); ?></div></td>
      <td class="qzt">硕士</td>
      <td><div align="center">TDF8H312</div></td>
      <td><div align="center"><?php echo $str->formatquantity($master); ?></div></td>
    </tr>
    <tr>
      <td>研发机构数</td>
      <td><div align="center">TDF8J103</div></td>
      <td><div align="center"><?php echo $str->formatquantity($CompInstitution); ?></div></td>
      <td class="qz">其中：研究生学历</td>
      <td><div align="center">TDF8H313</div></td>
      <td><div align="center"><?php echo $str->formatquantity($graduate); ?></div></td>
    </tr>
    <tr>
      <td>成果转化数</td>
      <td><div align="center">TDF8J104</div></td>
      <td><div align="center"><?php echo $str->formatquantity($achievement); ?></div></td>
      <td class="qzt">本科学历</td>
      <td><div align="center">TDF8H314</div></td>
      <td><div align="center"><?php echo $str->formatquantity($undergraduate); ?></div></td>
    </tr>
    <tr>
      <td class="qz"></b>其中：依托高校数量</td>
      <td><div align="center">TDF8J105</div></td>
      <td><div align="center"><?php echo $str->formatquantity($achievementschool); ?></div></td>
      <td class="qzt">大专学历</td>
      <td><div align="center">TDF8H315</div></td>
      <td><div align="center"><?php echo $str->formatquantity($college); ?></div></td>
    </tr>
    <tr>
      <td>获奖成果数</td>
      <td><div align="center">TDF8J106</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compachievement_award); ?></div></td>
      <td class="qzt">中专学历</td>
      <td><div align="center">TDF8H316</div></td>
      <td><div align="center"><?php echo $str->formatquantity($secondary); ?></div></td>
    </tr>
    <tr>
      <td>产出成果数</td>
      <td><div align="center">TDF8J107</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compachievement_output); ?></div></td>
      <td class="qz">其中：科技活动人员数</td>
      <td><div align="center">TDF8H317</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_technical); ?></div></td>
    </tr>
    <tr>
      <td colspan="3" class="lit">二、企业经济概况（单位：元/年）</td>
      <td class="qz">其中：研究与发展人员数</td>
      <td><div align="center">TDF8H318</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_rd); ?></div></td>
    </tr>
    <tr>
      <td>企业总收入</td>
      <td><div align="center">TDF8G210</div></td>
      <td><div align="center"><?php echo $str->formatquantity($general_income); ?></div></td>
      <td class="qz">其中：留学回国人员数</td>
      <td><div align="center">TDF8H319</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_stuoversea); ?></div></td>
    </tr>
    <tr>
      <td>企业工业总产值</td>
      <td><div align="center">TDF8G220</div></td>
      <td><div align="center"><?php echo $str->formatquantity($prospect); ?></div></td>
      <td>接纳大学生、研究生实习人天数</td>
      <td><div align="center">TDF8H320</div></td>
      <td><div align="center"><?php echo $str->formatquantity($intern_days); ?></div></td>
    </tr>
    <tr>
      <td>企业净利润</td>
      <td><div align="center">TDF8G230</div></td>
      <td><div align="center"><?php echo $str->formatquantity($net_profit); ?></div></td>
      <td>接纳应届毕业生就业人数</td>
      <td><div align="center">TDF8H321</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_newgraduates); ?></div></td>
    </tr>
    <tr>
      <td>企业上缴税金</td>
      <td><div align="center">TDF8G240</div></td>
      <td><div align="center"><?php echo $str->formatquantity($over_taxes); ?></div></td>
      <td colspan="3" class="lit">五、企业科技活动情况（单位：元/年）</td>
    </tr>
    <tr>
      <td>企业出口创汇</td>
      <td><div align="center">TDF8G250</div></td>
      <td><div align="center"><?php echo $str->formatquantity($qcll); ?></div></td>
      <td>承担各类计划项目数</td>
      <td><div align="center">TDF8K600</div></td>
      <td><div align="center"><?php echo $str->formatquantity($comptechnology); ?></div></td>
    </tr>
    <tr>
      <td colspan="3" class="lit">四、企业知识产权情况（单位：项）</td>
      <td class="qz">其中：国家级项目</td>
      <td><div align="center">TDF8K601</div></td>
      <td><div align="center"><?php echo $str->formatquantity($national); ?></div></td>
    </tr>
    <tr>
      <td>申请专利项数</td>
      <td><div align="center">TDF8F400</div></td>
      <td><div align="center"><?php echo $str->formatquantity($apply); ?></div></td>
      <td>科技活动经费支出总额</td>
      <td><div align="center">TDF8K610</div></td>
      <td><div align="center"><?php echo $str->formatquantity($cost); ?></div></td>
    </tr>
    <tr>
      <td class="qz">其中：发明专利</td>
      <td><div align="center">TDF8F410</div></td>
      <td><div align="center"><?php echo $str->formatquantity($applyinvent); ?></div></td>
      <td class="qz">其中：研究与试验发展支出</td>
      <td><div align="center">TDF8K620</div></td>
      <td><div align="center"><?php echo $str->formatquantity($research_exp); ?></div></td>
    </tr>
    <tr>
      <td>批准专利项数</td>
      <td><div align="center">TDF8F420</div></td>
      <td><div align="center"><?php echo $str->formatquantity($authorize); ?></div></td>
      <td class="qz">其中：新产品开发经费支出</td>
      <td><div align="center">TDF8K630</div></td>
      <td><div align="center"><?php echo $str->formatquantity($new_product); ?></div></td>
    </tr>
    <tr>
      <td class="qz">其中：发明专利</td>
      <td><div align="center">TDF8F430</div></td>
      <td><div align="center"><?php echo $str->formatquantity($authorizeinvent); ?></div></td>
      <td class="qz">其中：政府拨款</td>
      <td><div align="center">TDF8K640</div></td>
      <td><div align="center"><?php echo $str->formatquantity($govern_funding); ?></div></td>
    </tr>
    <tr>
      <td>购买国外技术专利数</td>
      <td><div align="center">TDF8F440</div></td>
      <td><div align="center"><?php echo $str->formatquantity($buy); ?></div></td>
      <td>企业自筹</td>
      <td><div align="center">TDF8K650</div></td>
      <td><div align="center"><?php echo $str->formatquantity($raised_enterprise); ?></div></td></div></td>
    </tr>
  </table>
  <div style="margin-top:5px;font-size:12px">
    <div><b>平衡关系</b>：TDF8J104≥TDF8J105 TDF8H300≥TDF8H(311+312) TDF8H300≥TDF8H(313+314+315+316)</div>
    <div style="padding-left:50px">TDF8H300≥TDF8H317≥TDF8H318 DF8H300≥TDF8H319 TDF8G210>TDF8G250*6.8</div>
    <div style="padding-left:50px">TDF8F400>TDF8F410 TDF8F420>TDF8F430 TDF8K610≥TDF8K620 TDF8K610≥TDF8K630</div>
  </div>
  <div style="margin-top:5px;">
	    企业负责人签字（盖章）：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	    报出日期：<?php echo date("Y年m月d日")?>
  </div>
</div>
		</div>
    </div>
</div>

<?php if(empty($report)){?>
<script>
var webpath=$("#getpath").attr('href');
var urlpath=webpath+"reports/showcompinfo/<?php echo $id;?>";
$(document).ready(function() {
	$("#ddlyear").change(function() {  
		searchreport();
	});
});
function searchreport()
{	
var year=$("#ddlyear").val();
if(year==""){
location.href=urlpath;
	}else{
	if(year!=""){
		urlpath+="?year="+year;
	}
	location.href=urlpath;
}
return false;
}
</script>		
<?php }?>